﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OracleClient;
using BCNPCObject.DB;
using DbLinq;
using DbLinq.Oracle;
using CMISLibrary.Entities;
using CMISLibrary;

namespace BCNPCObject
{
    public class cls_CN_HDON_GTHU_Controller
    {
        #region   Atributes

        private DataSet CMIS_Header = new CMISOutputParameter();
        private DataSet ds = new DataSet();
        private DataTable dt = new DataTable();
        private CN_HDON_GTHU info;
        private List<CN_HDON_GTHU> infolst;

        #endregion

        #region   Constructor

        public cls_CN_HDON_GTHU_Controller()
        {
            info = new CN_HDON_GTHU();
        }
        public cls_CN_HDON_GTHU_Controller(CN_HDON_GTHU Info)
        {
            this.info = Info;
        }
        public cls_CN_HDON_GTHU_Controller(List<CN_HDON_GTHU> Infolst, int i)
        {
            this.infolst = Infolst;
        }

        #endregion

        #region   Properties

        public CN_HDON_GTHU pInfor
        {
            get { return info; }
            set { info = value; }
        }

        #endregion

        #region  DungNT NPC

        public long GetSequence(ref string str)
        {
            try
            {
                long _sobbangiao = CMIS2.DB.ExecuteCommand("select SEQ_CN_BBGTHU_GIAO.nextval from dual", ref str);
                if (str.Trim().Length > 0) return -1;
                return _sobbangiao;
            }
            catch
            {
                //CMIS2.ResetDB(); 
                return -1;
            }
        }
        public bool INSERT_CN_HDON_GTHU(ref string strError)
        {
            try
            {
                CMIS2.DB.CN_HDON_GTHU.InsertAllOnSubmit(infolst);
                return true;
            }
            catch (Exception ex) { strError = ex.Message.ToString(); return false; }
        }
#endregion

     
    }
}

